# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=exploitpack
pkgver=139.e565c47
pkgrel=1
groups=('blackarch' 'blackarch-exploitation')
pkgdesc='The next generation exploit framework.'
arch=('any')
url='https://github.com/juansacco/exploitpack'
license=('GPL3')
depends=('java-environment')
makedepends=('git')
source=("git+https://github.com/juansacco/exploitpack.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.TXT

  rm README.TXT

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec java -jar ExploitPack.jar "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

